
<?php
//this php page is the main page of the application 
require_once('./header.php'); 
 ?>
<input id="hidsession" name="hidsession" type="hidden" value="<?php echo $user_session->getuser_id(); ?>"  />
<input id="hidrole_type" name="hidrole_type" type="hidden" value="<?php $userRole = user::get_role_type_byid($user_session->getuser_id());
echo $userRole['role_type'] ?>"  />
<input id="hid_id_project" name="hid_id_project" type="hidden" value="none" />

<script>
    function if_new_task()
    {
        var x =<?php echo $_SESSION['iframe']; ?>;
        $('#hid_iframe').val(x);

    }
    ;

</script> 
<div id="wrapper_body">

<?php require_once('./slidebar.php'); ?>

    <div id="content_frame">

        <div id="content" >
            <?php if (isset($_GET['admin'])) {//show control paner to authorized users
                echo "<script>goto_control_panel();	 </script>";
            } else { ?>  
                <?php
                if ($user_session->role_type == 1 || $user_session->role_type == 6) {


                    if (isset($_GET['project'])) {//user choosed project name
                        ?> 

                        <!-- show project tasks - admin and sales users can see also see open tasks -->
                        <script>
                            var id =<?php echo $_GET['project']; ?>;
                            show_project_ajax(id, $('#hid_session').val());
                            get_new_task();
                            $('#hid_id_project').val(id);
                        </script> 
        <?
        } else {//project wasn't selected show open tasks on main screen
            ?>  
                        <script>
                            get_new_task();

                        </script> 
        <?php
        }
    } else {//other role type users can see only open and updated tasks and not new ones - show tasks according to user
;
        ?>
                    <script>
                        get_tasks_open($('#hidsession').val());
                    </script>	
    <?php }
}
?>
        </div>
    </div>


</div>
<script>
    $(document).ready(function(e) {




        $('#hid_I').change(function() {
            alert('hid_I')
        });
    });

    function open_new_task()
    {
        $('#send_task').slideToggle();
        $('#send_task textarea').val('');

    }

</script> 
</div>	
</div>

<?php require_once('./footer.php'); ?>





